<?php
/**
 * Description of FotoService
 *
 * @author laimis
 */
class PhotoService {
    private $photoDAO;

    public function save($photo){
        if($photo->id != null){
            return $this->update($photo);
        }else{
            return $this->insert($photo);
        }
    }

    public function getAll(){
        return $this->photoDAO->getAll();
    }

    public function getById($id){
        return $this->photoDAO->getById($id);
    }

    public function getByGalleryId($id){
        return $this->photoDAO->getByGalleryId($id);
    }

    public function insert($photo){
        return $this->photoDAO->insert($photo);
    }

    public function update($photo){
        $this->photoDAO->update($photo);
    }

    public function delete($id){
        $this->photoDAO->delete($id);
    }

    public function PhotoService(){
        include_once BASEDAO;
        include_once PHOTODAO;
        include_once PHOTOENTITY;
        $this->photoDAO = new PhotoDAO();
    }
}
?>
